const accountInfo = wx.getAccountInfoSync()
let ENV =
  accountInfo.miniProgram.envVersion == 'release' ? 'production' : 'test'
let webRoot = null
let openId = null
switch (ENV) {
  case 'production':
    webRoot = 'https://device.x-washer.com/backend-dev'
  case 'test':
    //webRoot = 'http://localhost:8080/backend-dev'
    // webRoot = 'https://device.x-washer.com/backend-dev'
    webRoot = 'https://device.x-washer.com/backend-test'
    break
}
module.exports = {
  indexLog: 'https://device.x-washer.com:543/images/index03.png',
  indexOfficial: 'https://device.x-washer.com:543/images/official.jpg',
  shopLog: 'https://device.x-washer.com:543/images/shop.jpg',
  twoballLog: 'https://device.x-washer.com:543/images/twoball.png',
  ball01Log: 'https://device.x-washer.com:543/images/1.png',
  ball02Log: 'https://device.x-washer.com:543/images/2.png',
  getOpenIdByCode: webRoot + '/wechat/open/get/openid/by/code', //获取openId
  getAgentMessage: webRoot + '/wechat/open/get/agent/message', //获取代理人信息
  setAgentBingMsg: webRoot + '/wechat/open/agent/bing/msg', //代理人绑定
  getAgentDeviceList: webRoot + '/wechat/open/get/agent/device/list', //获取代理人的设备列表
  saveDevice: webRoot + '/wechat/open/save/device', //设备入库
  getAgentWashballList: webRoot + '/wechat/open/get/agent/washball/list', //获取代理人的洗衣球列表
  getEnduserMessage: webRoot + '/wechat/open/get/enduser/message', //获取终端经营用户的个人信息
  getEnduserDeviceList: webRoot + '/wechat/open/get/enduser/device/list', //获取终端经营用户的设备列表
  saveEnduserMessage: webRoot + '/wechat/open/save/enduser/message', //保存终端经营个人注册信息
  createEnduserInvitationCode:
    webRoot + '/wechat/open/create/enduser/invitation/code', //创建团队补货员激活码
  getEnduserReplenishmanList: webRoot + '/wechat/open/get/enduser/replenishman', //获取终端的补货员清单
  deleteEnduserReplenishmanByTeamId:
    webRoot + '/wechat/open/delete/enduser/replenishman', //删除补货员
  getJoinReplenishmanList: webRoot + '/wechat/open/get/join/replenishman', //获取自己作为补货员的团队
  bingReplenishmanByInvitationcode:
    webRoot + '/wechat/open/bing/replenishman/by/invitationcode', //绑定激活码成为补货员
  getDeviceByDeviceSn: webRoot + '/wechat/open/get/device/by/devicesn', //根据设备SN获取设备的配置信息
  getAllProductList: webRoot + '/wechat/open/get/all/product/list', //获取所有产品信息
  saveDevcieGridState: webRoot + '/wechat/open/save/devcie/grid/state', //保存设备格子的服务状态
  saveDevcieRepairFlag: webRoot + '/wechat/open/save/devcie/repair/flag', //保存设备补货状态
  initBuyPay: webRoot + '/wechat/open/buy/pay', //发起售卖支付
  saveDeviceBallBuyState: webRoot + '/wechat/open/save/buy/state', //购买成功后设置设备的格子状态和设备的补货状态
  initRentPay: webRoot + '/wechat/open/rent/pay', //租用发起订单支付押金
  unBingDeviceState: webRoot + '/wechat/open/unbing/devcie', //解绑设备
  getClientOrders: webRoot + '/wechat/open/get/client/orders', //获取消费者的订单
  saveEnduserCashoutSettings:
    webRoot + '/wechat/open/save/enduser/cashout/settings', //保存终端的提现设置
  saveAgentCashoutSettings:
    webRoot + '/wechat/open/save/agent/cashout/settings', //保存终端的提现设置
  dealGiveBackBall: webRoot + '/wechat/open/deal/give/back/ball', //归还数据处理
  dealErrorRentBallList: webRoot + '/wechat/open/deal/error/rent/ball/list', //扫码进去第一时间处理异常订单
  getEnduserOrders: webRoot + '/wechat/open/get/enduser/orders', //获取终端的订单列表
  getAgentOrders: webRoot + '/wechat/open/get/agent/orders', //获取代理人订单列表
  getRepairList: webRoot + '/wechat/open/get/repair/list', //获取终端的补货清单
  saveDeviceAddress: webRoot + '/wechat/open/save/device/address', //修改设备的地址
  checkDeviceForReplenishment:
    webRoot + '/wechat/open/check/device/for/replenishment', //补货员补货检查设备的合法性
  getAboutCompany: webRoot + '/wechat/open/get/about/company', //补货员补货检查设备的合法性
  webRoot: webRoot,
  openId: openId,
  ENV,
}
